/*
CUNY - GMapper
Software Design Lab
CSC 22100 - Spring 2011

TEAM 9:
Ariel Teferici
Ivan Tse
Michael Cheong

SVN Repository:
http://code.google.com/p/cuny-gmapper/
 */
package com.macavelly.com;

import com.macavelly.com.R;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class GMapper extends TabActivity{
	private TabHost tabHost;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		Resources res = getResources(); // Resource object to get Drawables
		tabHost = getTabHost();  // The activity TabHost
		TabHost.TabSpec homeTab;
		TabHost.TabSpec mapTab;
		TabHost.TabSpec creditsTab;  
		Intent homeIntent;
		Intent mapIntent;
		Intent creditsIntent;  

		// Create an Intent to launch an Activity for the tab (to be reused)
		homeIntent = new Intent().setClass(this, HomeActivity.class);
		// Initialize a TabSpec for each tab and add it to the TabHost
		homeTab = tabHost.newTabSpec("home");
		homeTab.setIndicator("Home", res.getDrawable(R.drawable.ic_tab_home));
		homeTab.setContent(homeIntent);
		tabHost.addTab(homeTab);

		// Do the same for the other tabs
		mapIntent = new Intent().setClass(this, MapsActivity.class);
		mapTab = tabHost.newTabSpec("map");
		mapTab.setIndicator("Map", res.getDrawable(R.drawable.ic_tab_map));
		mapTab.setContent(mapIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
		tabHost.addTab(mapTab);

		creditsIntent = new Intent().setClass(this, CreditsActivity.class);
		creditsTab = tabHost.newTabSpec("credits");
		creditsTab.setIndicator("Credits", res.getDrawable(R.drawable.ic_tab_credits));
		creditsTab.setContent(creditsIntent);
		tabHost.addTab(creditsTab);
		
		
		// Set the initial tab view
		tabHost.setCurrentTab(0);
		
		
	}
	
	
	
	
}